import axios from '@/request/http';
import base from "./base";
import {v5 as uuid} from "uuid";

const user = {
  userRegister(payload){
    return axios.post(`${base.sq}/users`,payload)
  },
  userLogin(payload){
    return axios.get(`${base.sq}/users/${uuid(payload.phone,uuid.DNS)}`);
  },
  getUsers(){
    return axios.get(`${base.sq}/users/`)
  },
  getUser(id){
    return axios.get(`${base.sq}/users/${id}`)
  },
  userDelete({id}){
    return axios.delete(`${base.sq}/users/${id}`)
  },
  userPatch(id,user){
    return axios.patch(`${base.sq}/users/${id}`,user)
  },
  userAdd(user){
    return axios.post(`${base.sq}/users`,user)
  }

}

export default user;
